package com.xt.string;

public class StringDemo1 {
    public static void main(String[] args) {
        // 目标: 掌握创建String对象, 并封装要处理的字符串的两种方式
        // 1. 直接双引号得到字符串对象封装字符串数据
        String name = "itheima";
        System.out.println(name);

        // 2. new String创建字符串对象, 并调用构造器来初始化字符串
        String res1 = "";
        System.out.println(res1);

        String res2 = new String("itheima");
        System.out.println(res2);

        char[] chars = { 'a', 'b', 'c' };
        String res3 = new String(chars);
        System.out.println(res3);

        byte[] bytes1 = { 1, 2, 3 };
        String res4 = new String(bytes1);
        System.out.println(res4);
    }
}
